package xyz.jangle.design.composite;
/**
 * 组合模式
 * @author Administrator
 *
 */
public class AppMain18 {

	public static void main(String[] args) {
		
		Composite firstNode = new Composite();
		Leaf leaf1 = new Leaf();
		Leaf leaf2 = new Leaf();
		Composite childNode = new Composite();
		Leaf childLeaf1 = new Leaf();
		Leaf childLeaf2 = new Leaf();
		
		firstNode.add(leaf1);
		firstNode.add(leaf2);
		firstNode.add(childNode);
		childNode.add(childLeaf1);
		childNode.add(childLeaf2);
		
		firstNode.opration();
		System.out.println("-------------");
		childNode.opration();
	}

}
